import request from '@/utils/request'
//  详情
const getArticleDetailAPI = ({ articleld }) => {
  return request({
    method: 'get',
    url: `/v1_0/articles/${articleld}`

  })
}

// 关注坐着
const followAutAPI = ({ authorld }) => {
  return request({
    method: 'post',
    url: '/v1_0/user/followings',
    data: {
      target: authorld
    }

  })
}

// 取消关注坐着
const unfollowAutAPI = ({ authorld }) => {
  return request({
    method: 'DELETE',
    url: `/v1_0/user/followings/${authorld}`
  })
}

// 爱点赞
const likeArticeAPI = ({ articleld }) => {
  return request({
    method: 'POST',
    url: '/v1_0/article/likings',
    data: {
      target: articleld
    }

  })
}
// 取消赞
const dislikeArticeAPI = ({ articleld }) => {
  return request({
    method: 'DELETE',
    url: `/v1_0/article/likings/${articleld}`
  })
}
// 评论
const getArticleCommentAPI = ({ articleld, offset, limit = 10 }) => {
  return request({
    method: 'get',
    url: '/v1_0/comments',
    params: {
      type: 'a',
      source: articleld,
      offset,
      limit
    }

  })
}

// 评论  喜欢
const likeCommentAPI = ({ commentid }) => {
  return request({
    method: 'post',
    url: '/v1_0/comment/likings',

    data: {
      target: commentid
    }
  })
}

// 评论  不喜欢
const dislikeCommentAPI = ({ commentid }) => {
  return request({
    method: 'DELETE',

    url: `/v1_0/comment/likings/${commentid}`
  })
}
// 发布
const publishCommentAPI = ({ articleld, content }) => {
  return request({
    method: 'post',
    url: '/v1_0/comments',
    data: {
      target: articleld,
      content
    }
  })
}
export {
  getArticleDetailAPI,
  followAutAPI,
  unfollowAutAPI,
  likeArticeAPI,
  dislikeArticeAPI,
  getArticleCommentAPI,
  likeCommentAPI,
  dislikeCommentAPI,
  publishCommentAPI

}
